import type { Response,Router } from "express"
import type { BindParameters } from "oracledb"

//定义route对象类型
interface Iroute {
  url: string
  fn: (router: Router, oracle: Ioracle, callbackFn: IcallbackFn) => Router
}

//定义返回Promise的类型
interface IreturnObj {
  code: number
  message: string
  data: Array<{ [key: string]: number | string }>
}

//定义传入参数
interface Ioptions {
  sql: string
  params?: BindParameters[]
  isMulti?: boolean
}

//定义回调函数的参数函数类型
interface Ifn {
  (options: Ioptions): Promise<IreturnObj>
}

//connectdb中类的类型
interface Ioracle {
  connHrm: Ifn
  connChaos: Ifn
  connHrTest: Ifn
  connChaosTest: Ifn
  connCcapps: Ifn
  connAppsTest: Ifn
  connFpgFlow:Ifn
  connCtShopFloor: Ifn
}

//回调函数类型
interface IcallbackFn {
  (res: Response, fn: Ifn, options: Ioptions): void
}

export { Iroute, Ioracle, IcallbackFn, IreturnObj, Ifn, Ioptions }
